from enum import Enum
from typing import Literal

class Object:

    def __combineAttr__(self):
        custom=[name for name in self.__dict__.keys() if not (name.startswith("__") and name.endswith("__"))]
        return ','.join(custom)

class PublishHistory:
    """
       PublishHistory 类用于记录发布的各种历史信息，如文件路径、发布时间、发布者及发布内容的知识点等。

       属性:
           file_path (str): 发布文件的路径。
           date (datetime): 发布的时间点。
           student (str): 发给学生的姓名或标识。
           knowledge (str): 发布内容涉及的知识点或主题。
       """

    def __init__(self):
        self.file_path = None
        self.date = None
        self.student = None
        self.knowledge = None

    def __str__(self):
        return f"file_path={self.file_path}, date={self.date}, student={self.student}, knowledge={self.knowledge}"

    def __combineAttr__(self):
        return 'file_path' + ',' + 'date' + ',' + 'student' + ',' + 'knowledge'

    def __table__(self):
        return 'publish_history'


class TopicLevel(Enum):
    EASY = '简单'
    MEDIUM = '中档'
    SLIGHTLY_DIFFICULT = '较难'
    DIFFICULT = '困难'


class Topic(Object):
    """
    题目
    """
    content = None
    answer = ''
    level: Literal[1, 2, 3, 4] = None  # 难易程度
    category: Literal[1, 2, 3, 4] = None
    score: float

    def __init__(self, content, examinations, modules,
                 answer, level,category,score,methods,method):
        self.content = content
        self.examinations = examinations
        self.modules = modules
        self.answer = answer
        self.level = level
        self.category=category
        self.score=score
        self.methods=methods
        self.method=method

    def __str__(self):
        return f"text={self.text}, image={self.image}," \
               f" knowledge={self.knowledge},answer={self.answer}," \
               f" level={self.level}"

    def __table__(self):
        return 'topic'


class Correcting(Object):
    topic_pos = ''
    student = ''
    date = None
    right = 0

    def __init__(self, topic_pos, student, date, right):
        self.topic_pos = topic_pos
        self.student = student
        self.date = date
        self.right = right

    def __table__(self):
        return 'correcting'


class Student(Object):
    name = ''
    age = 0
    grade = ''

    def __table__(self):
        return 'student'


class ClassRoom(Object):
    date = None
    time_period = ''
    student = ''

    def __init__(self,date,time_period,student):
        self.date=date
        self.time_period=time_period

    def __table__(self):
        return 'classroom'


columns = [
    name for name in Topic.__dict__.keys()
    if not (name.startswith("__") and name.endswith("__"))
]
print(columns)